package com.bdsy.business.service.impl;

import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.business.dao.ShopAuOrderMapper;
import com.bdsy.business.model.ShopAuOrder;
import com.bdsy.business.service.ShopAuOrderService;
import com.bdsy.common.utils.DateRandomUtil;
import com.bdsy.common.utils.DateUtil;
import com.bdsy.common.utils.UUIDUtil;

@Service
public class ShopAuOrderServiceImpl implements ShopAuOrderService {

	@Autowired
	private ShopAuOrderMapper shopAuOrderMapper;
	
	@Override
	public boolean add(ShopAuOrder shopAuOrder) {
		shopAuOrder.setAuId(DateRandomUtil.getRandomFileName());
		shopAuOrder.setAuOrderTime(DateUtil.getCurrentDate());
		shopAuOrder.setAuOrderStatus(0);
		int result = shopAuOrderMapper.add(shopAuOrder);
		return result>0?true:false;
	}

	@Override
	public List<Map> selectShopAuOrderById(int auOrderStatus, String userId) {
		return shopAuOrderMapper.selectShopAuOrderById(auOrderStatus, userId);
	}

	@Override
	public List<Map> selectShopAuOrder(int shopId) {
		return shopAuOrderMapper.selectShopAuOrder(shopId);
	}

	@Override
	public boolean update(ShopAuOrder shopAuOrder) {
		int result = shopAuOrderMapper.update(shopAuOrder);
		return result>0?true:false;
	}

	@Override
	public List<Map> selectAOrNShopAuOrder(int auOrderStatus, String userId, int shopTypeId,int qx) {
		return shopAuOrderMapper.selectAOrNShopAuOrder(auOrderStatus, userId, shopTypeId,qx);
	}

	@Override
	public int jsellCount(String userId) {
		return shopAuOrderMapper.jsellCount(userId);
	}

	@Override
	public int jacount(String userId) {
		return shopAuOrderMapper.jacount(userId);
	}

	@Override
	public int jncount(String userId) {
		return shopAuOrderMapper.jncount(userId);
	}

	@Override
	public List<Map> selectAuOrderByTypeOrStatus(int auOrderStatus, int shopTypeId,String userId) {
		return shopAuOrderMapper.selectAuOrderByTypeOrStatus(auOrderStatus, shopTypeId,userId);
	}

}
